{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "[pyecharts网站](https://pyecharts.org/)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 178,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 159,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>地区</th>\n",
       "      <th>2020年12月</th>\n",
       "      <th>2020年11月</th>\n",
       "      <th>2020年10月</th>\n",
       "      <th>2020年9月</th>\n",
       "      <th>2020年8月</th>\n",
       "      <th>2020年7月</th>\n",
       "      <th>2020年6月</th>\n",
       "      <th>2020年5月</th>\n",
       "      <th>2020年4月</th>\n",
       "      <th>Unnamed: 10</th>\n",
       "      <th>Unnamed: 11</th>\n",
       "      <th>Unnamed: 12</th>\n",
       "      <th>Unnamed: 13</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>广州</td>\n",
       "      <td>98.5</td>\n",
       "      <td>100.8</td>\n",
       "      <td>101.6</td>\n",
       "      <td>101.8</td>\n",
       "      <td>102.6</td>\n",
       "      <td>102.4</td>\n",
       "      <td>102.4</td>\n",
       "      <td>102.7</td>\n",
       "      <td>103.6</td>\n",
       "      <td>103.8</td>\n",
       "      <td>104.8</td>\n",
       "      <td>104.3</td>\n",
       "      <td>103.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>兰州</td>\n",
       "      <td>99.1</td>\n",
       "      <td>100.5</td>\n",
       "      <td>101.3</td>\n",
       "      <td>102.2</td>\n",
       "      <td>102.2</td>\n",
       "      <td>101.6</td>\n",
       "      <td>101.4</td>\n",
       "      <td>101.5</td>\n",
       "      <td>102.0</td>\n",
       "      <td>103.3</td>\n",
       "      <td>104.9</td>\n",
       "      <td>104.2</td>\n",
       "      <td>103.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>宁波</td>\n",
       "      <td>99.3</td>\n",
       "      <td>100.3</td>\n",
       "      <td>100.7</td>\n",
       "      <td>101.3</td>\n",
       "      <td>101.5</td>\n",
       "      <td>102.0</td>\n",
       "      <td>101.7</td>\n",
       "      <td>101.5</td>\n",
       "      <td>102.1</td>\n",
       "      <td>103.9</td>\n",
       "      <td>105</td>\n",
       "      <td>106.1</td>\n",
       "      <td>104.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>西安</td>\n",
       "      <td>99.4</td>\n",
       "      <td>100.1</td>\n",
       "      <td>100.6</td>\n",
       "      <td>101.7</td>\n",
       "      <td>102.2</td>\n",
       "      <td>101.7</td>\n",
       "      <td>102.0</td>\n",
       "      <td>101.7</td>\n",
       "      <td>102.2</td>\n",
       "      <td>103.8</td>\n",
       "      <td>104.7</td>\n",
       "      <td>105.3</td>\n",
       "      <td>104.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>西宁</td>\n",
       "      <td>99.4</td>\n",
       "      <td>100.6</td>\n",
       "      <td>101.7</td>\n",
       "      <td>103.0</td>\n",
       "      <td>102.8</td>\n",
       "      <td>102.5</td>\n",
       "      <td>102.8</td>\n",
       "      <td>102.6</td>\n",
       "      <td>103.1</td>\n",
       "      <td>101.4</td>\n",
       "      <td>102.2</td>\n",
       "      <td>103.4</td>\n",
       "      <td>102.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>乌鲁木齐</td>\n",
       "      <td>99.5</td>\n",
       "      <td>99.8</td>\n",
       "      <td>100.1</td>\n",
       "      <td>99.9</td>\n",
       "      <td>100.8</td>\n",
       "      <td>100.9</td>\n",
       "      <td>100.9</td>\n",
       "      <td>100.0</td>\n",
       "      <td>100.8</td>\n",
       "      <td>104.1</td>\n",
       "      <td>105.1</td>\n",
       "      <td>105.4</td>\n",
       "      <td>103.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>沈阳</td>\n",
       "      <td>99.5</td>\n",
       "      <td>99.8</td>\n",
       "      <td>100.6</td>\n",
       "      <td>102.0</td>\n",
       "      <td>101.4</td>\n",
       "      <td>102.0</td>\n",
       "      <td>101.4</td>\n",
       "      <td>102.1</td>\n",
       "      <td>102.5</td>\n",
       "      <td>103.8</td>\n",
       "      <td>105.2</td>\n",
       "      <td>104.8</td>\n",
       "      <td>103.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>南京</td>\n",
       "      <td>99.7</td>\n",
       "      <td>99.7</td>\n",
       "      <td>100.3</td>\n",
       "      <td>101.5</td>\n",
       "      <td>102.6</td>\n",
       "      <td>102.7</td>\n",
       "      <td>102.2</td>\n",
       "      <td>102.2</td>\n",
       "      <td>102.9</td>\n",
       "      <td>104</td>\n",
       "      <td>105.3</td>\n",
       "      <td>105.5</td>\n",
       "      <td>104.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>太原</td>\n",
       "      <td>99.8</td>\n",
       "      <td>99.7</td>\n",
       "      <td>100.4</td>\n",
       "      <td>101.7</td>\n",
       "      <td>102.8</td>\n",
       "      <td>102.8</td>\n",
       "      <td>103.4</td>\n",
       "      <td>103.1</td>\n",
       "      <td>102.8</td>\n",
       "      <td>104.8</td>\n",
       "      <td>105.8</td>\n",
       "      <td>105.4</td>\n",
       "      <td>104</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>南昌</td>\n",
       "      <td>99.8</td>\n",
       "      <td>99.9</td>\n",
       "      <td>101.0</td>\n",
       "      <td>101.6</td>\n",
       "      <td>102.3</td>\n",
       "      <td>103.2</td>\n",
       "      <td>102.5</td>\n",
       "      <td>102.1</td>\n",
       "      <td>102.8</td>\n",
       "      <td>103</td>\n",
       "      <td>104.2</td>\n",
       "      <td>104.1</td>\n",
       "      <td>103.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>昆明</td>\n",
       "      <td>99.9</td>\n",
       "      <td>100.5</td>\n",
       "      <td>102.3</td>\n",
       "      <td>103.2</td>\n",
       "      <td>103.6</td>\n",
       "      <td>102.8</td>\n",
       "      <td>102.2</td>\n",
       "      <td>102.8</td>\n",
       "      <td>103.6</td>\n",
       "      <td>103.5</td>\n",
       "      <td>104.9</td>\n",
       "      <td>105.8</td>\n",
       "      <td>104.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>长沙</td>\n",
       "      <td>99.9</td>\n",
       "      <td>99.4</td>\n",
       "      <td>100.6</td>\n",
       "      <td>101.6</td>\n",
       "      <td>101.6</td>\n",
       "      <td>102.8</td>\n",
       "      <td>101.7</td>\n",
       "      <td>100.8</td>\n",
       "      <td>102.0</td>\n",
       "      <td>104.4</td>\n",
       "      <td>105.5</td>\n",
       "      <td>105.5</td>\n",
       "      <td>105.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>南宁</td>\n",
       "      <td>99.9</td>\n",
       "      <td>99.8</td>\n",
       "      <td>100.7</td>\n",
       "      <td>101.3</td>\n",
       "      <td>101.2</td>\n",
       "      <td>102.1</td>\n",
       "      <td>102.2</td>\n",
       "      <td>102.3</td>\n",
       "      <td>103.3</td>\n",
       "      <td>104.3</td>\n",
       "      <td>105.6</td>\n",
       "      <td>105.6</td>\n",
       "      <td>104.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>郑州</td>\n",
       "      <td>100.0</td>\n",
       "      <td>99.4</td>\n",
       "      <td>100.4</td>\n",
       "      <td>102.0</td>\n",
       "      <td>102.1</td>\n",
       "      <td>102.2</td>\n",
       "      <td>101.7</td>\n",
       "      <td>101.8</td>\n",
       "      <td>102.9</td>\n",
       "      <td>104.3</td>\n",
       "      <td>104.3</td>\n",
       "      <td>104.5</td>\n",
       "      <td>103.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>合肥</td>\n",
       "      <td>100.1</td>\n",
       "      <td>99.3</td>\n",
       "      <td>100.4</td>\n",
       "      <td>101.6</td>\n",
       "      <td>102.3</td>\n",
       "      <td>103.1</td>\n",
       "      <td>102.9</td>\n",
       "      <td>101.8</td>\n",
       "      <td>102.5</td>\n",
       "      <td>103.2</td>\n",
       "      <td>103.6</td>\n",
       "      <td>104.5</td>\n",
       "      <td>103.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>厦门</td>\n",
       "      <td>100.1</td>\n",
       "      <td>99.2</td>\n",
       "      <td>100.2</td>\n",
       "      <td>101.6</td>\n",
       "      <td>102.1</td>\n",
       "      <td>102.8</td>\n",
       "      <td>102.6</td>\n",
       "      <td>102.5</td>\n",
       "      <td>103.6</td>\n",
       "      <td>103.5</td>\n",
       "      <td>103.8</td>\n",
       "      <td>104.5</td>\n",
       "      <td>103.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>银川</td>\n",
       "      <td>100.2</td>\n",
       "      <td>99.6</td>\n",
       "      <td>101.1</td>\n",
       "      <td>102.0</td>\n",
       "      <td>102.1</td>\n",
       "      <td>101.5</td>\n",
       "      <td>101.3</td>\n",
       "      <td>101.8</td>\n",
       "      <td>102.7</td>\n",
       "      <td>104.7</td>\n",
       "      <td>105.2</td>\n",
       "      <td>105.1</td>\n",
       "      <td>103.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>青岛</td>\n",
       "      <td>100.2</td>\n",
       "      <td>98.9</td>\n",
       "      <td>100.4</td>\n",
       "      <td>102.0</td>\n",
       "      <td>102.4</td>\n",
       "      <td>102.3</td>\n",
       "      <td>102.6</td>\n",
       "      <td>102.7</td>\n",
       "      <td>103.2</td>\n",
       "      <td>103.6</td>\n",
       "      <td>104.3</td>\n",
       "      <td>105</td>\n",
       "      <td>104</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>石家庄</td>\n",
       "      <td>100.2</td>\n",
       "      <td>99.4</td>\n",
       "      <td>100.8</td>\n",
       "      <td>102.4</td>\n",
       "      <td>102.7</td>\n",
       "      <td>102.5</td>\n",
       "      <td>102.5</td>\n",
       "      <td>102.2</td>\n",
       "      <td>102.3</td>\n",
       "      <td>104.1</td>\n",
       "      <td>105.1</td>\n",
       "      <td>105.6</td>\n",
       "      <td>104.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>上海</td>\n",
       "      <td>100.2</td>\n",
       "      <td>99.9</td>\n",
       "      <td>100.3</td>\n",
       "      <td>101.3</td>\n",
       "      <td>101.4</td>\n",
       "      <td>101.6</td>\n",
       "      <td>101.7</td>\n",
       "      <td>102.0</td>\n",
       "      <td>102.5</td>\n",
       "      <td>103.3</td>\n",
       "      <td>103.5</td>\n",
       "      <td>103.1</td>\n",
       "      <td>103.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>北京</td>\n",
       "      <td>100.2</td>\n",
       "      <td>100.2</td>\n",
       "      <td>100.9</td>\n",
       "      <td>101.0</td>\n",
       "      <td>100.9</td>\n",
       "      <td>100.7</td>\n",
       "      <td>101.4</td>\n",
       "      <td>101.9</td>\n",
       "      <td>102.4</td>\n",
       "      <td>104.2</td>\n",
       "      <td>104.6</td>\n",
       "      <td>105.8</td>\n",
       "      <td>105.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>大连</td>\n",
       "      <td>100.2</td>\n",
       "      <td>99.8</td>\n",
       "      <td>100.8</td>\n",
       "      <td>102.1</td>\n",
       "      <td>101.5</td>\n",
       "      <td>102.2</td>\n",
       "      <td>102.3</td>\n",
       "      <td>102.1</td>\n",
       "      <td>102.3</td>\n",
       "      <td>103.6</td>\n",
       "      <td>104.4</td>\n",
       "      <td>105.2</td>\n",
       "      <td>105</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>哈尔滨</td>\n",
       "      <td>100.2</td>\n",
       "      <td>98.8</td>\n",
       "      <td>99.2</td>\n",
       "      <td>99.8</td>\n",
       "      <td>99.7</td>\n",
       "      <td>100.2</td>\n",
       "      <td>101.3</td>\n",
       "      <td>102.1</td>\n",
       "      <td>103.1</td>\n",
       "      <td>102.8</td>\n",
       "      <td>103</td>\n",
       "      <td>104.3</td>\n",
       "      <td>103.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>长春</td>\n",
       "      <td>100.4</td>\n",
       "      <td>99.0</td>\n",
       "      <td>100.3</td>\n",
       "      <td>101.7</td>\n",
       "      <td>101.2</td>\n",
       "      <td>101.6</td>\n",
       "      <td>101.2</td>\n",
       "      <td>102.0</td>\n",
       "      <td>102.7</td>\n",
       "      <td>106.8</td>\n",
       "      <td>106.3</td>\n",
       "      <td>104.9</td>\n",
       "      <td>104.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>杭州</td>\n",
       "      <td>100.4</td>\n",
       "      <td>99.3</td>\n",
       "      <td>100.3</td>\n",
       "      <td>101.1</td>\n",
       "      <td>101.6</td>\n",
       "      <td>102.4</td>\n",
       "      <td>102.1</td>\n",
       "      <td>101.6</td>\n",
       "      <td>102.7</td>\n",
       "      <td>103.5</td>\n",
       "      <td>103.8</td>\n",
       "      <td>104.6</td>\n",
       "      <td>104.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>天津</td>\n",
       "      <td>100.5</td>\n",
       "      <td>99.6</td>\n",
       "      <td>100.5</td>\n",
       "      <td>101.5</td>\n",
       "      <td>102.1</td>\n",
       "      <td>102.2</td>\n",
       "      <td>102.2</td>\n",
       "      <td>102.2</td>\n",
       "      <td>102.6</td>\n",
       "      <td>104.2</td>\n",
       "      <td>105.8</td>\n",
       "      <td>104.9</td>\n",
       "      <td>104</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>贵阳</td>\n",
       "      <td>100.5</td>\n",
       "      <td>99.2</td>\n",
       "      <td>100.4</td>\n",
       "      <td>101.7</td>\n",
       "      <td>102.5</td>\n",
       "      <td>102.1</td>\n",
       "      <td>101.9</td>\n",
       "      <td>102.3</td>\n",
       "      <td>103.8</td>\n",
       "      <td>104.5</td>\n",
       "      <td>106</td>\n",
       "      <td>105.4</td>\n",
       "      <td>104.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>成都</td>\n",
       "      <td>100.6</td>\n",
       "      <td>98.7</td>\n",
       "      <td>99.8</td>\n",
       "      <td>101.4</td>\n",
       "      <td>102.3</td>\n",
       "      <td>103.0</td>\n",
       "      <td>103.7</td>\n",
       "      <td>103.2</td>\n",
       "      <td>103.3</td>\n",
       "      <td>104.1</td>\n",
       "      <td>104.9</td>\n",
       "      <td>104.8</td>\n",
       "      <td>104</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>武汉</td>\n",
       "      <td>100.6</td>\n",
       "      <td>98.8</td>\n",
       "      <td>99.6</td>\n",
       "      <td>100.8</td>\n",
       "      <td>101.9</td>\n",
       "      <td>102.4</td>\n",
       "      <td>101.5</td>\n",
       "      <td>102.0</td>\n",
       "      <td>104.7</td>\n",
       "      <td>104.5</td>\n",
       "      <td>105.2</td>\n",
       "      <td>106.7</td>\n",
       "      <td>104.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>深圳</td>\n",
       "      <td>100.7</td>\n",
       "      <td>98.7</td>\n",
       "      <td>99.9</td>\n",
       "      <td>101.0</td>\n",
       "      <td>102.1</td>\n",
       "      <td>102.1</td>\n",
       "      <td>102.3</td>\n",
       "      <td>102.7</td>\n",
       "      <td>103.7</td>\n",
       "      <td>103.5</td>\n",
       "      <td>104.2</td>\n",
       "      <td>104.9</td>\n",
       "      <td>104.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>重庆</td>\n",
       "      <td>100.7</td>\n",
       "      <td>99.4</td>\n",
       "      <td>100.5</td>\n",
       "      <td>101.6</td>\n",
       "      <td>102.4</td>\n",
       "      <td>102.8</td>\n",
       "      <td>102.4</td>\n",
       "      <td>102.1</td>\n",
       "      <td>102.7</td>\n",
       "      <td>103.9</td>\n",
       "      <td>104.7</td>\n",
       "      <td>106.1</td>\n",
       "      <td>105.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>福州</td>\n",
       "      <td>100.9</td>\n",
       "      <td>99.2</td>\n",
       "      <td>101.2</td>\n",
       "      <td>102.0</td>\n",
       "      <td>102.9</td>\n",
       "      <td>102.6</td>\n",
       "      <td>102.3</td>\n",
       "      <td>102.3</td>\n",
       "      <td>103.5</td>\n",
       "      <td>104.3</td>\n",
       "      <td>104.5</td>\n",
       "      <td>105.3</td>\n",
       "      <td>105.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>呼和浩特</td>\n",
       "      <td>101.0</td>\n",
       "      <td>99.5</td>\n",
       "      <td>100.4</td>\n",
       "      <td>101.4</td>\n",
       "      <td>102.4</td>\n",
       "      <td>102.0</td>\n",
       "      <td>102.0</td>\n",
       "      <td>101.8</td>\n",
       "      <td>102.7</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>济南</td>\n",
       "      <td>101.0</td>\n",
       "      <td>98.4</td>\n",
       "      <td>100.0</td>\n",
       "      <td>101.9</td>\n",
       "      <td>103.0</td>\n",
       "      <td>102.8</td>\n",
       "      <td>102.6</td>\n",
       "      <td>103.0</td>\n",
       "      <td>103.3</td>\n",
       "      <td>2020年3月</td>\n",
       "      <td>2020年2月</td>\n",
       "      <td>2020年1月</td>\n",
       "      <td>2019年12月</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>海口</td>\n",
       "      <td>101.4</td>\n",
       "      <td>98.0</td>\n",
       "      <td>100.5</td>\n",
       "      <td>100.2</td>\n",
       "      <td>100.2</td>\n",
       "      <td>101.3</td>\n",
       "      <td>101.6</td>\n",
       "      <td>101.9</td>\n",
       "      <td>103.7</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>103.4</td>\n",
       "      <td>104.5</td>\n",
       "      <td>103.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>102.5</td>\n",
       "      <td>103.8</td>\n",
       "      <td>103.4</td>\n",
       "      <td>102.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>103.5</td>\n",
       "      <td>104.3</td>\n",
       "      <td>104.6</td>\n",
       "      <td>102.6</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      地区  2020年12月  2020年11月  2020年10月  2020年9月  2020年8月  2020年7月  2020年6月  \\\n",
       "0     广州      98.5     100.8     101.6    101.8    102.6    102.4    102.4   \n",
       "1     兰州      99.1     100.5     101.3    102.2    102.2    101.6    101.4   \n",
       "2     宁波      99.3     100.3     100.7    101.3    101.5    102.0    101.7   \n",
       "3     西安      99.4     100.1     100.6    101.7    102.2    101.7    102.0   \n",
       "4     西宁      99.4     100.6     101.7    103.0    102.8    102.5    102.8   \n",
       "5   乌鲁木齐      99.5      99.8     100.1     99.9    100.8    100.9    100.9   \n",
       "6     沈阳      99.5      99.8     100.6    102.0    101.4    102.0    101.4   \n",
       "7     南京      99.7      99.7     100.3    101.5    102.6    102.7    102.2   \n",
       "8     太原      99.8      99.7     100.4    101.7    102.8    102.8    103.4   \n",
       "9     南昌      99.8      99.9     101.0    101.6    102.3    103.2    102.5   \n",
       "10    昆明      99.9     100.5     102.3    103.2    103.6    102.8    102.2   \n",
       "11    长沙      99.9      99.4     100.6    101.6    101.6    102.8    101.7   \n",
       "12    南宁      99.9      99.8     100.7    101.3    101.2    102.1    102.2   \n",
       "13    郑州     100.0      99.4     100.4    102.0    102.1    102.2    101.7   \n",
       "14    合肥     100.1      99.3     100.4    101.6    102.3    103.1    102.9   \n",
       "15    厦门     100.1      99.2     100.2    101.6    102.1    102.8    102.6   \n",
       "16    银川     100.2      99.6     101.1    102.0    102.1    101.5    101.3   \n",
       "17    青岛     100.2      98.9     100.4    102.0    102.4    102.3    102.6   \n",
       "18   石家庄     100.2      99.4     100.8    102.4    102.7    102.5    102.5   \n",
       "19    上海     100.2      99.9     100.3    101.3    101.4    101.6    101.7   \n",
       "20    北京     100.2     100.2     100.9    101.0    100.9    100.7    101.4   \n",
       "21    大连     100.2      99.8     100.8    102.1    101.5    102.2    102.3   \n",
       "22   哈尔滨     100.2      98.8      99.2     99.8     99.7    100.2    101.3   \n",
       "23    长春     100.4      99.0     100.3    101.7    101.2    101.6    101.2   \n",
       "24    杭州     100.4      99.3     100.3    101.1    101.6    102.4    102.1   \n",
       "25    天津     100.5      99.6     100.5    101.5    102.1    102.2    102.2   \n",
       "26    贵阳     100.5      99.2     100.4    101.7    102.5    102.1    101.9   \n",
       "27    成都     100.6      98.7      99.8    101.4    102.3    103.0    103.7   \n",
       "28    武汉     100.6      98.8      99.6    100.8    101.9    102.4    101.5   \n",
       "29    深圳     100.7      98.7      99.9    101.0    102.1    102.1    102.3   \n",
       "30    重庆     100.7      99.4     100.5    101.6    102.4    102.8    102.4   \n",
       "31    福州     100.9      99.2     101.2    102.0    102.9    102.6    102.3   \n",
       "32  呼和浩特     101.0      99.5     100.4    101.4    102.4    102.0    102.0   \n",
       "33    济南     101.0      98.4     100.0    101.9    103.0    102.8    102.6   \n",
       "34    海口     101.4      98.0     100.5    100.2    100.2    101.3    101.6   \n",
       "35   NaN       NaN       NaN       NaN      NaN      NaN      NaN      NaN   \n",
       "36   NaN       NaN       NaN       NaN      NaN      NaN      NaN      NaN   \n",
       "37   NaN       NaN       NaN       NaN      NaN      NaN      NaN      NaN   \n",
       "\n",
       "    2020年5月  2020年4月 Unnamed: 10 Unnamed: 11 Unnamed: 12 Unnamed: 13  \n",
       "0     102.7    103.6       103.8       104.8       104.3       103.7  \n",
       "1     101.5    102.0       103.3       104.9       104.2       103.4  \n",
       "2     101.5    102.1       103.9         105       106.1       104.4  \n",
       "3     101.7    102.2       103.8       104.7       105.3       104.5  \n",
       "4     102.6    103.1       101.4       102.2       103.4       102.6  \n",
       "5     100.0    100.8       104.1       105.1       105.4       103.7  \n",
       "6     102.1    102.5       103.8       105.2       104.8       103.9  \n",
       "7     102.2    102.9         104       105.3       105.5       104.5  \n",
       "8     103.1    102.8       104.8       105.8       105.4         104  \n",
       "9     102.1    102.8         103       104.2       104.1       103.6  \n",
       "10    102.8    103.6       103.5       104.9       105.8       104.5  \n",
       "11    100.8    102.0       104.4       105.5       105.5       105.3  \n",
       "12    102.3    103.3       104.3       105.6       105.6       104.3  \n",
       "13    101.8    102.9       104.3       104.3       104.5       103.2  \n",
       "14    101.8    102.5       103.2       103.6       104.5       103.3  \n",
       "15    102.5    103.6       103.5       103.8       104.5       103.3  \n",
       "16    101.8    102.7       104.7       105.2       105.1       103.9  \n",
       "17    102.7    103.2       103.6       104.3         105         104  \n",
       "18    102.2    102.3       104.1       105.1       105.6       104.4  \n",
       "19    102.0    102.5       103.3       103.5       103.1       103.4  \n",
       "20    101.9    102.4       104.2       104.6       105.8       105.3  \n",
       "21    102.1    102.3       103.6       104.4       105.2         105  \n",
       "22    102.1    103.1       102.8         103       104.3       103.8  \n",
       "23    102.0    102.7       106.8       106.3       104.9       104.2  \n",
       "24    101.6    102.7       103.5       103.8       104.6       104.1  \n",
       "25    102.2    102.6       104.2       105.8       104.9         104  \n",
       "26    102.3    103.8       104.5         106       105.4       104.4  \n",
       "27    103.2    103.3       104.1       104.9       104.8         104  \n",
       "28    102.0    104.7       104.5       105.2       106.7       104.9  \n",
       "29    102.7    103.7       103.5       104.2       104.9       104.3  \n",
       "30    102.1    102.7       103.9       104.7       106.1       105.5  \n",
       "31    102.3    103.5       104.3       104.5       105.3       105.5  \n",
       "32    101.8    102.7         NaN         NaN         NaN         NaN  \n",
       "33    103.0    103.3     2020年3月     2020年2月     2020年1月    2019年12月  \n",
       "34    101.9    103.7         NaN         NaN         NaN         NaN  \n",
       "35      NaN      NaN         NaN       103.4       104.5       103.8  \n",
       "36      NaN      NaN       102.5       103.8       103.4       102.9  \n",
       "37      NaN      NaN       103.5       104.3       104.6       102.6  "
      ]
     },
     "execution_count": 159,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_excel(\"主要城市月度价格.xls\", encoding=\"utf8\")\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 219,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['广州',\n",
       " '兰州',\n",
       " '宁波',\n",
       " '西安',\n",
       " '西宁',\n",
       " '乌鲁木齐',\n",
       " '沈阳',\n",
       " '南京',\n",
       " '太原',\n",
       " '南昌',\n",
       " '昆明',\n",
       " '长沙',\n",
       " '南宁',\n",
       " '郑州',\n",
       " '合肥',\n",
       " '厦门',\n",
       " '银川',\n",
       " '青岛',\n",
       " '石家庄',\n",
       " '上海',\n",
       " '北京',\n",
       " '大连',\n",
       " '哈尔滨',\n",
       " '长春',\n",
       " '杭州',\n",
       " '天津',\n",
       " '贵阳',\n",
       " '成都',\n",
       " '武汉',\n",
       " '深圳',\n",
       " '重庆',\n",
       " '福州',\n",
       " '呼和浩特',\n",
       " '济南',\n",
       " '海口',\n",
       " nan,\n",
       " nan,\n",
       " nan]"
      ]
     },
     "execution_count": 219,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "DQ = df['地区'].tolist()\n",
    "DQ"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 231,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[98.5,\n",
       " 99.1,\n",
       " 99.3,\n",
       " 99.4,\n",
       " 99.4,\n",
       " 99.5,\n",
       " 99.5,\n",
       " 99.7,\n",
       " 99.8,\n",
       " 99.8,\n",
       " 99.9,\n",
       " 99.9,\n",
       " 99.9,\n",
       " 100.0,\n",
       " 100.1,\n",
       " 100.1,\n",
       " 100.2,\n",
       " 100.2,\n",
       " 100.2,\n",
       " 100.2,\n",
       " 100.2,\n",
       " 100.2,\n",
       " 100.2,\n",
       " 100.4,\n",
       " 100.4,\n",
       " 100.5,\n",
       " 100.5,\n",
       " 100.6,\n",
       " 100.6,\n",
       " 100.7,\n",
       " 100.7,\n",
       " 100.9,\n",
       " 101.0,\n",
       " 101.0,\n",
       " 101.4,\n",
       " nan,\n",
       " nan,\n",
       " nan]"
      ]
     },
     "execution_count": 231,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ZS = df['2020年12月'].tolist()\n",
    "ZS"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 235,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Bar\n",
    "from pyecharts.faker import Faker\n",
    "\n",
    "c = (\n",
    "    Bar()\n",
    "    .add_xaxis(DQ)\n",
    "    .add_yaxis(\"2020_12消费价格指数\", ZS, color=Faker.rand_color())\n",
    "    .set_global_opts(\n",
    "        title_opts=opts.TitleOpts(title=\"2020年十二月中大城市消费价格指数\"),\n",
    "        datazoom_opts=[opts.DataZoomOpts(), opts.DataZoomOpts(type_=\"inside\")],\n",
    "    )\n",
    "    .render(\"bar_datazoom_both.html\")\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 163,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>地区</th>\n",
       "      <th>2020年12月</th>\n",
       "      <th>2020年11月</th>\n",
       "      <th>2020年10月</th>\n",
       "      <th>2020年9月</th>\n",
       "      <th>2020年8月</th>\n",
       "      <th>2020年7月</th>\n",
       "      <th>2020年6月</th>\n",
       "      <th>2020年5月</th>\n",
       "      <th>2020年4月</th>\n",
       "      <th>Unnamed: 10</th>\n",
       "      <th>Unnamed: 11</th>\n",
       "      <th>Unnamed: 12</th>\n",
       "      <th>Unnamed: 13</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>广州</td>\n",
       "      <td>98.5</td>\n",
       "      <td>100.8</td>\n",
       "      <td>101.6</td>\n",
       "      <td>101.8</td>\n",
       "      <td>102.6</td>\n",
       "      <td>102.4</td>\n",
       "      <td>102.4</td>\n",
       "      <td>102.7</td>\n",
       "      <td>103.6</td>\n",
       "      <td>103.8</td>\n",
       "      <td>104.8</td>\n",
       "      <td>104.3</td>\n",
       "      <td>103.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>兰州</td>\n",
       "      <td>99.1</td>\n",
       "      <td>100.5</td>\n",
       "      <td>101.3</td>\n",
       "      <td>102.2</td>\n",
       "      <td>102.2</td>\n",
       "      <td>101.6</td>\n",
       "      <td>101.4</td>\n",
       "      <td>101.5</td>\n",
       "      <td>102.0</td>\n",
       "      <td>103.3</td>\n",
       "      <td>104.9</td>\n",
       "      <td>104.2</td>\n",
       "      <td>103.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>宁波</td>\n",
       "      <td>99.3</td>\n",
       "      <td>100.3</td>\n",
       "      <td>100.7</td>\n",
       "      <td>101.3</td>\n",
       "      <td>101.5</td>\n",
       "      <td>102.0</td>\n",
       "      <td>101.7</td>\n",
       "      <td>101.5</td>\n",
       "      <td>102.1</td>\n",
       "      <td>103.9</td>\n",
       "      <td>105</td>\n",
       "      <td>106.1</td>\n",
       "      <td>104.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>西安</td>\n",
       "      <td>99.4</td>\n",
       "      <td>100.1</td>\n",
       "      <td>100.6</td>\n",
       "      <td>101.7</td>\n",
       "      <td>102.2</td>\n",
       "      <td>101.7</td>\n",
       "      <td>102.0</td>\n",
       "      <td>101.7</td>\n",
       "      <td>102.2</td>\n",
       "      <td>103.8</td>\n",
       "      <td>104.7</td>\n",
       "      <td>105.3</td>\n",
       "      <td>104.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>西宁</td>\n",
       "      <td>99.4</td>\n",
       "      <td>100.6</td>\n",
       "      <td>101.7</td>\n",
       "      <td>103.0</td>\n",
       "      <td>102.8</td>\n",
       "      <td>102.5</td>\n",
       "      <td>102.8</td>\n",
       "      <td>102.6</td>\n",
       "      <td>103.1</td>\n",
       "      <td>101.4</td>\n",
       "      <td>102.2</td>\n",
       "      <td>103.4</td>\n",
       "      <td>102.6</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   地区  2020年12月  2020年11月  2020年10月  2020年9月  2020年8月  2020年7月  2020年6月  \\\n",
       "0  广州      98.5     100.8     101.6    101.8    102.6    102.4    102.4   \n",
       "1  兰州      99.1     100.5     101.3    102.2    102.2    101.6    101.4   \n",
       "2  宁波      99.3     100.3     100.7    101.3    101.5    102.0    101.7   \n",
       "3  西安      99.4     100.1     100.6    101.7    102.2    101.7    102.0   \n",
       "4  西宁      99.4     100.6     101.7    103.0    102.8    102.5    102.8   \n",
       "\n",
       "   2020年5月  2020年4月 Unnamed: 10 Unnamed: 11 Unnamed: 12 Unnamed: 13  \n",
       "0    102.7    103.6       103.8       104.8       104.3       103.7  \n",
       "1    101.5    102.0       103.3       104.9       104.2       103.4  \n",
       "2    101.5    102.1       103.9         105       106.1       104.4  \n",
       "3    101.7    102.2       103.8       104.7       105.3       104.5  \n",
       "4    102.6    103.1       101.4       102.2       103.4       102.6  "
      ]
     },
     "execution_count": 163,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 取2020年12月消费价格指数比较低的五个城市\n",
    "fileNameStr='主要城市月度价格.xls' \n",
    "xls = pd.ExcelFile(fileNameStr) \n",
    "salesDf = xls.parse('主要城市月度价格') \n",
    "salesDf.head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 164,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['广州', '兰州', '宁波', '西安', '西宁']"
      ]
     },
     "execution_count": 164,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "地区 = salesDf.head(5)['地区'].tolist()\n",
    "地区"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 165,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[98.5, 99.1, 99.3, 99.4, 99.4]"
      ]
     },
     "execution_count": 165,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ZJ = salesDf.head(5)['2020年12月'].tolist()\n",
    "ZJ"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 176,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pyecharts\n",
    "import pyecharts.options as opts\n",
    "from pyecharts.charts import Line\n",
    "from pyecharts.faker import Faker\n",
    "\n",
    "c = (\n",
    "    Line()\n",
    "    .add_xaxis(地区)\n",
    "    .add_yaxis(\"地区\", ZJ, is_connect_nones=True)\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"12月较少五个城市消费价格指数\"))\n",
    "    .render(\"12月较少五个城市消费价格指数.html\")\n",
    ")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 167,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'C:\\\\Users\\\\wxy00\\\\Downloads\\\\消费价格指数.html'"
      ]
     },
     "execution_count": 167,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pyecharts.options as opts\n",
    "from pyecharts.charts import Line\n",
    "\n",
    "\n",
    "x_data = ['2020年12月','2020年11月','2020年10月','2020年9月','2020年8月']\n",
    "y_data = [90,92,94,96,98,100,102]\n",
    "\n",
    "\n",
    "(\n",
    "    Line()\n",
    "    .add_xaxis(xaxis_data=x_data)\n",
    "    .add_yaxis(\n",
    "        series_name=\"广州\",\n",
    "        stack=\"指数\",\n",
    "        y_axis=[98.5,100.8,101.6,101.8,102.6],\n",
    "        label_opts=opts.LabelOpts(is_show=False),\n",
    "    )\n",
    "    .add_yaxis(\n",
    "        series_name=\"兰州\",\n",
    "        stack=\"指数\",\n",
    "        y_axis=[99.1,100.5,101.3,102.2,102.2],\n",
    "        label_opts=opts.LabelOpts(is_show=False),\n",
    "    )\n",
    "    .add_yaxis(\n",
    "        series_name=\"宁波\",\n",
    "        stack=\"指数\",\n",
    "        y_axis=[99.3,100.3,100.7,101.3,101.5],\n",
    "        label_opts=opts.LabelOpts(is_show=False),\n",
    "    )\n",
    "    .add_yaxis(\n",
    "        series_name=\"西安\",\n",
    "        stack=\"指数\",\n",
    "        y_axis=[99.4,100.1,100.6,101.7,102.2],\n",
    "        label_opts=opts.LabelOpts(is_show=False),\n",
    "    )\n",
    "    .add_yaxis(\n",
    "        series_name=\"西宁\",\n",
    "        stack=\"指数\",\n",
    "        y_axis=[99.4,100.6,101.7,103.0,102.8],\n",
    "        label_opts=opts.LabelOpts(is_show=False),\n",
    "    )\n",
    "    .set_global_opts(\n",
    "        title_opts=opts.TitleOpts(title=\"消费价格指数\"),\n",
    "        tooltip_opts=opts.TooltipOpts(trigger=\"axis\"),\n",
    "        yaxis_opts=opts.AxisOpts(\n",
    "            type_=\"value\",\n",
    "            axistick_opts=opts.AxisTickOpts(is_show=True),\n",
    "            splitline_opts=opts.SplitLineOpts(is_show=True),\n",
    "        ),\n",
    "        xaxis_opts=opts.AxisOpts(type_=\"category\", boundary_gap=False),\n",
    "    )\n",
    "    .render(\"消费价格指数.html\")\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 168,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>地区</th>\n",
       "      <th>2019年</th>\n",
       "      <th>2018年</th>\n",
       "      <th>2017年</th>\n",
       "      <th>2016年</th>\n",
       "      <th>2015年</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>厦门</td>\n",
       "      <td>NaN</td>\n",
       "      <td>55.3</td>\n",
       "      <td>55.2</td>\n",
       "      <td>55.5</td>\n",
       "      <td>56.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>深圳</td>\n",
       "      <td>NaN</td>\n",
       "      <td>57.2</td>\n",
       "      <td>57.5</td>\n",
       "      <td>56.9</td>\n",
       "      <td>56.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>广州</td>\n",
       "      <td>55.6</td>\n",
       "      <td>55.5</td>\n",
       "      <td>55.3</td>\n",
       "      <td>55.3</td>\n",
       "      <td>55.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>武汉</td>\n",
       "      <td>55.1</td>\n",
       "      <td>56.4</td>\n",
       "      <td>56.1</td>\n",
       "      <td>55.9</td>\n",
       "      <td>55.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>上海</td>\n",
       "      <td>54.9</td>\n",
       "      <td>54.6</td>\n",
       "      <td>55.7</td>\n",
       "      <td>56.2</td>\n",
       "      <td>56.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>天津</td>\n",
       "      <td>53.8</td>\n",
       "      <td>54.3</td>\n",
       "      <td>53.9</td>\n",
       "      <td>54.1</td>\n",
       "      <td>54.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>北京</td>\n",
       "      <td>53.7</td>\n",
       "      <td>53.7</td>\n",
       "      <td>53.2</td>\n",
       "      <td>54.3</td>\n",
       "      <td>53.3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   地区  2019年  2018年  2017年  2016年  2015年\n",
       "0  厦门    NaN   55.3   55.2   55.5   56.0\n",
       "1  深圳    NaN   57.2   57.5   56.9   56.8\n",
       "2  广州   55.6   55.5   55.3   55.3   55.2\n",
       "3  武汉   55.1   56.4   56.1   55.9   55.9\n",
       "4  上海   54.9   54.6   55.7   56.2   56.2\n",
       "5  天津   53.8   54.3   53.9   54.1   54.2\n",
       "6  北京   53.7   53.7   53.2   54.3   53.3"
      ]
     },
     "execution_count": 168,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "DF = pd.read_excel(\"主要城市年度数据.xls\", encoding=\"utf8\")\n",
    "DF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 169,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['厦门', '深圳', '广州', '武汉', '上海', '天津', '北京']"
      ]
     },
     "execution_count": 169,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "地_区 = DF['地区'].tolist()\n",
    "地_区"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 170,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[nan, nan, 55.6, 55.1, 54.9, 53.8, 53.7]"
      ]
     },
     "execution_count": 170,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "YJ = DF['2019年'].tolist()\n",
    "YJ"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 171,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[55.3, 57.2, 55.5, 56.4, 54.6, 54.3, 53.7]"
      ]
     },
     "execution_count": 171,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "YB = DF['2018年'].tolist()\n",
    "YB"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 172,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[55.2, 57.5, 55.3, 56.1, 55.7, 53.9, 53.2]"
      ]
     },
     "execution_count": 172,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "YQ = DF['2017年'].tolist()\n",
    "YQ"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 173,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[55.5, 56.9, 55.3, 55.9, 56.2, 54.1, 54.3]"
      ]
     },
     "execution_count": 173,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "YL = DF['2016年'].tolist()\n",
    "YL"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 174,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[56.0, 56.8, 55.2, 55.9, 56.2, 54.2, 53.3]"
      ]
     },
     "execution_count": 174,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "YW = DF['2015年'].tolist()\n",
    "YW"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 211,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'C:\\\\Users\\\\wxy00\\\\Downloads\\\\城市环境噪声.html'"
      ]
     },
     "execution_count": 211,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Line, Scatter\n",
    "from pyecharts.faker import Faker\n",
    "\n",
    "# 用0代替NaN\n",
    "x = 地_区\n",
    "line = (\n",
    "    Line()\n",
    "    .add_xaxis(['2019','2018','2017','2016','2015'])\n",
    "    .add_yaxis(\"厦门\", [0,55.3,55.2,55.5,56.0])\n",
    "    .add_yaxis(\"深圳\", [0,57.2,57.5,56.9,56.8])\n",
    "    .add_yaxis(\"广州\", [55.6,55.5,55.3,55.3,55.2])\n",
    "    .add_yaxis(\"武汉\", [55.1,56.4,56.1,55.9,55.9])\n",
    "    .add_yaxis(\"上海\", [54.9,54.6,55.7,56.2,56.2])\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"城市环境噪声\"))\n",
    ")\n",
    "scatter = (\n",
    "    Scatter()\n",
    "    .add_xaxis(x)\n",
    "    .add_yaxis(\"厦门\", [0,55.3,55.2,55.5,56.0])\n",
    "    .add_yaxis(\"深圳\", [0,57.2,57.5,56.9,56.8])\n",
    "    .add_yaxis(\"广州\", [55.6,55.5,55.3,55.3,55.2])\n",
    "    .add_yaxis(\"武汉\", [55.1,56.4,56.1,55.9,55.9])\n",
    "    .add_yaxis(\"上海\", [54.9,54.6,55.7,56.2,56.2])\n",
    ")\n",
    "line.overlap(scatter)\n",
    "line.render(\"城市环境噪声.html\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 192,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>地区</th>\n",
       "      <th>2020年第三季度</th>\n",
       "      <th>2020年第二季度</th>\n",
       "      <th>2020年第一季度</th>\n",
       "      <th>2019年第四季度</th>\n",
       "      <th>2019年第三季度</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>广东省</td>\n",
       "      <td>78397.07</td>\n",
       "      <td>49234.20</td>\n",
       "      <td>22518.67</td>\n",
       "      <td>107671.07</td>\n",
       "      <td>77460.42</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>江苏省</td>\n",
       "      <td>73808.77</td>\n",
       "      <td>46722.92</td>\n",
       "      <td>21002.80</td>\n",
       "      <td>99631.52</td>\n",
       "      <td>71676.63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>山东省</td>\n",
       "      <td>52186.01</td>\n",
       "      <td>33025.83</td>\n",
       "      <td>14919.34</td>\n",
       "      <td>71067.53</td>\n",
       "      <td>51127.20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>浙江省</td>\n",
       "      <td>45825.92</td>\n",
       "      <td>29086.63</td>\n",
       "      <td>13113.99</td>\n",
       "      <td>62351.74</td>\n",
       "      <td>44856.91</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>河南省</td>\n",
       "      <td>39876.71</td>\n",
       "      <td>25608.46</td>\n",
       "      <td>11510.15</td>\n",
       "      <td>54259.20</td>\n",
       "      <td>39035.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>四川省</td>\n",
       "      <td>34905.03</td>\n",
       "      <td>22130.27</td>\n",
       "      <td>10172.85</td>\n",
       "      <td>46615.82</td>\n",
       "      <td>33536.22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>福建省</td>\n",
       "      <td>31331.55</td>\n",
       "      <td>19901.39</td>\n",
       "      <td>8999.09</td>\n",
       "      <td>42395.00</td>\n",
       "      <td>30499.69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>湖南省</td>\n",
       "      <td>29780.59</td>\n",
       "      <td>19026.38</td>\n",
       "      <td>8824.82</td>\n",
       "      <td>39752.12</td>\n",
       "      <td>28598.36</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>湖北省</td>\n",
       "      <td>29779.42</td>\n",
       "      <td>17480.51</td>\n",
       "      <td>6379.35</td>\n",
       "      <td>45828.31</td>\n",
       "      <td>32969.67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>安徽省</td>\n",
       "      <td>27668.07</td>\n",
       "      <td>17551.13</td>\n",
       "      <td>7821.26</td>\n",
       "      <td>37113.98</td>\n",
       "      <td>26700.44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>上海市</td>\n",
       "      <td>27301.99</td>\n",
       "      <td>17356.80</td>\n",
       "      <td>7856.62</td>\n",
       "      <td>38155.32</td>\n",
       "      <td>27449.59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>河北省</td>\n",
       "      <td>25804.37</td>\n",
       "      <td>16387.25</td>\n",
       "      <td>7410.13</td>\n",
       "      <td>35104.52</td>\n",
       "      <td>25254.80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>北京市</td>\n",
       "      <td>25759.51</td>\n",
       "      <td>16205.55</td>\n",
       "      <td>7462.19</td>\n",
       "      <td>35371.28</td>\n",
       "      <td>25446.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>陕西省</td>\n",
       "      <td>18681.48</td>\n",
       "      <td>11794.92</td>\n",
       "      <td>5439.66</td>\n",
       "      <td>25793.17</td>\n",
       "      <td>18556.05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>江西省</td>\n",
       "      <td>18387.77</td>\n",
       "      <td>11691.13</td>\n",
       "      <td>5343.43</td>\n",
       "      <td>24757.50</td>\n",
       "      <td>17810.97</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>辽宁省</td>\n",
       "      <td>17707.97</td>\n",
       "      <td>11132.49</td>\n",
       "      <td>5082.07</td>\n",
       "      <td>24909.45</td>\n",
       "      <td>17920.29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>重庆市</td>\n",
       "      <td>17707.10</td>\n",
       "      <td>11209.83</td>\n",
       "      <td>4987.66</td>\n",
       "      <td>23605.77</td>\n",
       "      <td>16982.40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>云南省</td>\n",
       "      <td>17539.76</td>\n",
       "      <td>11129.77</td>\n",
       "      <td>5107.77</td>\n",
       "      <td>23223.75</td>\n",
       "      <td>16707.57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>广西壮族自治区</td>\n",
       "      <td>15999.07</td>\n",
       "      <td>10206.04</td>\n",
       "      <td>4670.85</td>\n",
       "      <td>21237.14</td>\n",
       "      <td>15278.36</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>贵州省</td>\n",
       "      <td>12650.00</td>\n",
       "      <td>7985.53</td>\n",
       "      <td>3704.04</td>\n",
       "      <td>16769.34</td>\n",
       "      <td>12064.15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>山西省</td>\n",
       "      <td>12499.90</td>\n",
       "      <td>7821.64</td>\n",
       "      <td>3634.73</td>\n",
       "      <td>17026.68</td>\n",
       "      <td>12249.29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>内蒙古自治区</td>\n",
       "      <td>12319.99</td>\n",
       "      <td>7704.09</td>\n",
       "      <td>3550.88</td>\n",
       "      <td>17212.53</td>\n",
       "      <td>12382.99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>天津市</td>\n",
       "      <td>10095.43</td>\n",
       "      <td>6309.28</td>\n",
       "      <td>2874.35</td>\n",
       "      <td>14104.28</td>\n",
       "      <td>10146.86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>新疆维吾尔自治区</td>\n",
       "      <td>9819.94</td>\n",
       "      <td>6412.80</td>\n",
       "      <td>3055.51</td>\n",
       "      <td>13597.11</td>\n",
       "      <td>9781.99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>吉林省</td>\n",
       "      <td>8796.68</td>\n",
       "      <td>5441.92</td>\n",
       "      <td>2441.84</td>\n",
       "      <td>11726.82</td>\n",
       "      <td>8436.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>黑龙江省</td>\n",
       "      <td>8619.67</td>\n",
       "      <td>5250.63</td>\n",
       "      <td>2409.04</td>\n",
       "      <td>13612.68</td>\n",
       "      <td>8744.81</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>甘肃省</td>\n",
       "      <td>6444.28</td>\n",
       "      <td>4101.90</td>\n",
       "      <td>1908.27</td>\n",
       "      <td>8718.30</td>\n",
       "      <td>6272.10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>海南省</td>\n",
       "      <td>3841.31</td>\n",
       "      <td>2383.01</td>\n",
       "      <td>1115.28</td>\n",
       "      <td>5308.93</td>\n",
       "      <td>3819.34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>宁夏回族自治区</td>\n",
       "      <td>2796.02</td>\n",
       "      <td>1763.86</td>\n",
       "      <td>808.13</td>\n",
       "      <td>3748.48</td>\n",
       "      <td>2696.72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>青海省</td>\n",
       "      <td>2170.13</td>\n",
       "      <td>1390.74</td>\n",
       "      <td>652.68</td>\n",
       "      <td>2965.95</td>\n",
       "      <td>2133.76</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>西藏自治区</td>\n",
       "      <td>1308.32</td>\n",
       "      <td>838.38</td>\n",
       "      <td>384.58</td>\n",
       "      <td>1697.82</td>\n",
       "      <td>1221.44</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          地区  2020年第三季度  2020年第二季度  2020年第一季度  2019年第四季度  2019年第三季度\n",
       "0        广东省   78397.07   49234.20   22518.67  107671.07   77460.42\n",
       "1        江苏省   73808.77   46722.92   21002.80   99631.52   71676.63\n",
       "2        山东省   52186.01   33025.83   14919.34   71067.53   51127.20\n",
       "3        浙江省   45825.92   29086.63   13113.99   62351.74   44856.91\n",
       "4        河南省   39876.71   25608.46   11510.15   54259.20   39035.00\n",
       "5        四川省   34905.03   22130.27   10172.85   46615.82   33536.22\n",
       "6        福建省   31331.55   19901.39    8999.09   42395.00   30499.69\n",
       "7        湖南省   29780.59   19026.38    8824.82   39752.12   28598.36\n",
       "8        湖北省   29779.42   17480.51    6379.35   45828.31   32969.67\n",
       "9        安徽省   27668.07   17551.13    7821.26   37113.98   26700.44\n",
       "10       上海市   27301.99   17356.80    7856.62   38155.32   27449.59\n",
       "11       河北省   25804.37   16387.25    7410.13   35104.52   25254.80\n",
       "12       北京市   25759.51   16205.55    7462.19   35371.28   25446.71\n",
       "13       陕西省   18681.48   11794.92    5439.66   25793.17   18556.05\n",
       "14       江西省   18387.77   11691.13    5343.43   24757.50   17810.97\n",
       "15       辽宁省   17707.97   11132.49    5082.07   24909.45   17920.29\n",
       "16       重庆市   17707.10   11209.83    4987.66   23605.77   16982.40\n",
       "17       云南省   17539.76   11129.77    5107.77   23223.75   16707.57\n",
       "18   广西壮族自治区   15999.07   10206.04    4670.85   21237.14   15278.36\n",
       "19       贵州省   12650.00    7985.53    3704.04   16769.34   12064.15\n",
       "20       山西省   12499.90    7821.64    3634.73   17026.68   12249.29\n",
       "21    内蒙古自治区   12319.99    7704.09    3550.88   17212.53   12382.99\n",
       "22       天津市   10095.43    6309.28    2874.35   14104.28   10146.86\n",
       "23  新疆维吾尔自治区    9819.94    6412.80    3055.51   13597.11    9781.99\n",
       "24       吉林省    8796.68    5441.92    2441.84   11726.82    8436.48\n",
       "25      黑龙江省    8619.67    5250.63    2409.04   13612.68    8744.81\n",
       "26       甘肃省    6444.28    4101.90    1908.27    8718.30    6272.10\n",
       "27       海南省    3841.31    2383.01    1115.28    5308.93    3819.34\n",
       "28   宁夏回族自治区    2796.02    1763.86     808.13    3748.48    2696.72\n",
       "29       青海省    2170.13    1390.74     652.68    2965.95    2133.76\n",
       "30     西藏自治区    1308.32     838.38     384.58    1697.82    1221.44"
      ]
     },
     "execution_count": 192,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 地区生产总值\n",
    "Df = pd.read_excel(\"分省季度数据.xls\", encoding=\"utf8\")\n",
    "Df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 193,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>地区</th>\n",
       "      <th>2020年第三季度</th>\n",
       "      <th>2020年第二季度</th>\n",
       "      <th>2020年第一季度</th>\n",
       "      <th>2019年第四季度</th>\n",
       "      <th>2019年第三季度</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>广东省</td>\n",
       "      <td>78397.07</td>\n",
       "      <td>49234.20</td>\n",
       "      <td>22518.67</td>\n",
       "      <td>107671.07</td>\n",
       "      <td>77460.42</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>江苏省</td>\n",
       "      <td>73808.77</td>\n",
       "      <td>46722.92</td>\n",
       "      <td>21002.80</td>\n",
       "      <td>99631.52</td>\n",
       "      <td>71676.63</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    地区  2020年第三季度  2020年第二季度  2020年第一季度  2019年第四季度  2019年第三季度\n",
       "0  广东省   78397.07   49234.20   22518.67  107671.07   77460.42\n",
       "1  江苏省   73808.77   46722.92   21002.80   99631.52   71676.63"
      ]
     },
     "execution_count": 193,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 取生产总值前两个省\n",
    "fileNameStr='分省季度数据.xls' \n",
    "xls = pd.ExcelFile(fileNameStr) \n",
    "salesDf = xls.parse('分省季度数据') \n",
    "salesDf.head(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 194,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['广东省', '江苏省']"
      ]
     },
     "execution_count": 194,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 取地区名称\n",
    "NB = salesDf.head(2)['地区'].tolist()\n",
    "NB"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 208,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyecharts.charts import Bar\n",
    "from pyecharts.faker import Faker\n",
    "from pyecharts.globals import ThemeType\n",
    "\n",
    "c = (\n",
    "    Bar({\"theme\": ThemeType.MACARONS})\n",
    "    .add_xaxis(['2020年第三季度','2020年第二季度','2020年第一季度','2019年第四季度','2019年第三季度'])\n",
    "    .add_yaxis(\"广东省\", [78397.07,49234.20,22518.67,107671.07,77460.42])\n",
    "    .add_yaxis(\"江苏省\", [73808.77,46722.92,21002.80,99631.52,71676.63])\n",
    "    .set_global_opts(\n",
    "        title_opts={\"text\": \"前两省市生产总值\", \"subtext\": \"广东省和江苏省\"}\n",
    "    )\n",
    "    .render(\"bar_base_dict_config.html\")\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 239,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>指标</th>\n",
       "      <th>2020年第四季度</th>\n",
       "      <th>2020年第三季度</th>\n",
       "      <th>2020年第二季度</th>\n",
       "      <th>2020年第一季度</th>\n",
       "      <th>2019年第四季度</th>\n",
       "      <th>2019年第三季度</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>69434</td>\n",
       "      <td>51772</td>\n",
       "      <td>34573</td>\n",
       "      <td>17874</td>\n",
       "      <td>67756</td>\n",
       "      <td>50541</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>城镇居民人均可支配收入累计值(元)</td>\n",
       "      <td>75602</td>\n",
       "      <td>56214</td>\n",
       "      <td>37560</td>\n",
       "      <td>19349</td>\n",
       "      <td>73849</td>\n",
       "      <td>54865</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>农村居民人均可支配收入累计值(元)</td>\n",
       "      <td>30126</td>\n",
       "      <td>23465</td>\n",
       "      <td>15536</td>\n",
       "      <td>8477</td>\n",
       "      <td>28928</td>\n",
       "      <td>22983</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>居民人均消费支出累计值(元)</td>\n",
       "      <td>38903</td>\n",
       "      <td>27944</td>\n",
       "      <td>18620</td>\n",
       "      <td>10003</td>\n",
       "      <td>43038</td>\n",
       "      <td>31542</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>城镇居民人均消费支出累计值(元)</td>\n",
       "      <td>41726</td>\n",
       "      <td>29947</td>\n",
       "      <td>19908</td>\n",
       "      <td>10680</td>\n",
       "      <td>46358</td>\n",
       "      <td>34004</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>农村居民人均消费支出累计值(元)</td>\n",
       "      <td>20913</td>\n",
       "      <td>15179</td>\n",
       "      <td>10408</td>\n",
       "      <td>5690</td>\n",
       "      <td>21881</td>\n",
       "      <td>15850</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  指标  2020年第四季度  2020年第三季度  2020年第二季度  2020年第一季度  2019年第四季度  \\\n",
       "0    居民人均可支配收入累计值(元)      69434      51772      34573      17874      67756   \n",
       "1  城镇居民人均可支配收入累计值(元)      75602      56214      37560      19349      73849   \n",
       "2  农村居民人均可支配收入累计值(元)      30126      23465      15536       8477      28928   \n",
       "3     居民人均消费支出累计值(元)      38903      27944      18620      10003      43038   \n",
       "4   城镇居民人均消费支出累计值(元)      41726      29947      19908      10680      46358   \n",
       "5   农村居民人均消费支出累计值(元)      20913      15179      10408       5690      21881   \n",
       "\n",
       "   2019年第三季度  \n",
       "0      50541  \n",
       "1      54865  \n",
       "2      22983  \n",
       "3      31542  \n",
       "4      34004  \n",
       "5      15850  "
      ]
     },
     "execution_count": 239,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 北京市城乡居民基本收支情况\n",
    "dF = pd.read_excel(\"北京市.xls\", encoding=\"utf8\")\n",
    "dF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 246,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['居民人均可支配收入累计值(元)',\n",
       " '城镇居民人均可支配收入累计值(元)',\n",
       " '农村居民人均可支配收入累计值(元)',\n",
       " '居民人均消费支出累计值(元)',\n",
       " '城镇居民人均消费支出累计值(元)',\n",
       " '农村居民人均消费支出累计值(元)']"
      ]
     },
     "execution_count": 246,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 取指标名称\n",
    "ZB = dF['指标'].tolist()\n",
    "ZB"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 247,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'C:\\\\Users\\\\wxy00\\\\Downloads\\\\basic_candlestick.html'"
      ]
     },
     "execution_count": 247,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pyecharts.options as opts\n",
    "from pyecharts.charts import Candlestick\n",
    "\n",
    "x_data = ZB\n",
    "y_data = [[69434,51772,34573,17874,67756,50541], [75602,56214,37560,19349,73849,54865], [30126,23465,15536,8477,28928,22983], [38903,27944,18620,10003,43038,31542],[41726,29947,19908,10680,46358,34004],[20913,15179,10408,5690,21881,15850]]\n",
    "\n",
    "(\n",
    "    Candlestick(init_opts=opts.InitOpts(width=\"1440px\", height=\"720px\"))\n",
    "    .add_xaxis(xaxis_data=x_data)\n",
    "    .add_yaxis(series_name=\"\", y_axis=y_data)\n",
    "    .set_series_opts()\n",
    "    .set_global_opts(\n",
    "        yaxis_opts=opts.AxisOpts(\n",
    "            splitline_opts=opts.SplitLineOpts(\n",
    "                is_show=True, linestyle_opts=opts.LineStyleOpts(width=1)\n",
    "            )\n",
    "        )\n",
    "    )\n",
    "    .render(\"basic_candlestick.html\")\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 244,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>指标</th>\n",
       "      <th>2020年第四季度</th>\n",
       "      <th>2020年第三季度</th>\n",
       "      <th>2020年第二季度</th>\n",
       "      <th>2020年第一季度</th>\n",
       "      <th>2019年第四季度</th>\n",
       "      <th>2019年第三季度</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>居民人均可支配收入累计值(元)</td>\n",
       "      <td>41029</td>\n",
       "      <td>32034</td>\n",
       "      <td>20774</td>\n",
       "      <td>10956</td>\n",
       "      <td>39014</td>\n",
       "      <td>30755</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>城镇居民人均可支配收入累计值(元)</td>\n",
       "      <td>50257</td>\n",
       "      <td>39272</td>\n",
       "      <td>25607</td>\n",
       "      <td>13487</td>\n",
       "      <td>48118</td>\n",
       "      <td>37945</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>农村居民人均可支配收入累计值(元)</td>\n",
       "      <td>20143</td>\n",
       "      <td>15741</td>\n",
       "      <td>9894</td>\n",
       "      <td>5326</td>\n",
       "      <td>18818</td>\n",
       "      <td>14888</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>居民人均消费支出累计值(元)</td>\n",
       "      <td>28492</td>\n",
       "      <td>20532</td>\n",
       "      <td>13113</td>\n",
       "      <td>6886</td>\n",
       "      <td>28995</td>\n",
       "      <td>20997</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>城镇居民人均消费支出累计值(元)</td>\n",
       "      <td>33511</td>\n",
       "      <td>24272</td>\n",
       "      <td>15443</td>\n",
       "      <td>8078</td>\n",
       "      <td>34424</td>\n",
       "      <td>25042</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>农村居民人均消费支出累计值(元)</td>\n",
       "      <td>17132</td>\n",
       "      <td>12112</td>\n",
       "      <td>7867</td>\n",
       "      <td>4235</td>\n",
       "      <td>16949</td>\n",
       "      <td>12071</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  指标  2020年第四季度  2020年第三季度  2020年第二季度  2020年第一季度  2019年第四季度  \\\n",
       "0    居民人均可支配收入累计值(元)      41029      32034      20774      10956      39014   \n",
       "1  城镇居民人均可支配收入累计值(元)      50257      39272      25607      13487      48118   \n",
       "2  农村居民人均可支配收入累计值(元)      20143      15741       9894       5326      18818   \n",
       "3     居民人均消费支出累计值(元)      28492      20532      13113       6886      28995   \n",
       "4   城镇居民人均消费支出累计值(元)      33511      24272      15443       8078      34424   \n",
       "5   农村居民人均消费支出累计值(元)      17132      12112       7867       4235      16949   \n",
       "\n",
       "   2019年第三季度  \n",
       "0      30755  \n",
       "1      37945  \n",
       "2      14888  \n",
       "3      20997  \n",
       "4      25042  \n",
       "5      12071  "
      ]
     },
     "execution_count": 244,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 广东省城乡居民基本收支情况\n",
    "D_F = pd.read_excel(\"广东省.xls\", encoding=\"utf8\")\n",
    "D_F"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 249,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[41029, 50257, 20143, 28492, 33511, 17132]"
      ]
     },
     "execution_count": 249,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 取2020年第四季度数值\n",
    "Fr = D_F['2020年第四季度'].tolist()\n",
    "Fr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 251,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import EffectScatter\n",
    "from pyecharts.faker import Faker\n",
    "from pyecharts.globals import SymbolType\n",
    "\n",
    "c = (\n",
    "    EffectScatter()\n",
    "    .add_xaxis(ZB)\n",
    "    .add_yaxis(\"\", Fr, symbol=SymbolType.ARROW)\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"广东省2020年第四季度城乡收支基本情况\"))\n",
    "    .render(\"effectscatter_symbol.html\")\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
